# Importing Data
MENA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Plastic/Plastics.xlsx",sheet = "Sheet1", range = "d1:d70")

# Checking the Imported Data
View(MENA)
# Creating Time Series Data
MENA_ts <- ts(MENA, start=c(2006), end=c(2018), frequency=1)
# Viewing and Checking the Created Time Series Data
MENA_ts
sum(is.na(MENA_ts))
library(forecast)
MENA_ts <- tsclean(MENA_ts)
MENA_ts

# Identification: Plotting the Time Series Data
plot(MENA_ts)

# Estimating the appropriate model
MENA_ts_model <- auto.arima(MENA_ts)
MENA_ts_model

# Forecasting
options(max.print=1000000)
MENA_ts_forecast <- forecast (MENA_ts_model, level=c(95), h=22)
plot(MENA_ts_forecast)
MENA_ts_forecast             

# Exporting
write.table(MENA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Plastic/MENA_TSA.csv", sep=",")


